package light.head.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.hibernate.annotations.Formula;

/**
 * 领用信息表
 */
@Entity
@Table
public class Consuming implements Serializable{


	private static final long serialVersionUID = 8026992189948023970L;

	
	private Integer code;
	private Boolean confirm;				//领用确定
	private Integer cc;						//领用人
	private Integer cu;						//创建人
	private Date ct;						//创建时间
	private Integer oc;
	private Boolean deleted;
	
	
	private String cn;						
	private String on;
	private String cname;				//领用人名称
	
	
	private List<ConsumingItem> itemList;					//领用详情	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	@Column
	public Integer getCu() {
		return cu;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(updatable = false, nullable = false)
	public Date getCt() {
		return ct;
	}
	@Column
	public Boolean getConfirm() {
		return confirm;
	}
	@Column
	public Integer getCc() {
		return cc;
	}
	@Column
	public Boolean getDeleted() {
		return deleted;
	}

	@Column
	public Integer getOc() {
		return oc;
	}
	@Transient
	public List<ConsumingItem> getItemList() {
		return itemList;
	}
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = cu )")
	public String getCn() {
		return cn;
	}

	@Formula("(SELECT o.name FROM Organ o WHERE o.code = oc )")
	public String getOn() {
		return on;
	}
	@Formula("(SELECT u.realName FROM UserInfo u WHERE u.code = cc )")
	public String getCname() {
		return cname;
	}
	
	
	
	
	public void setCname(String cname) {
		this.cname = cname;
	}
	public void setConfirm(Boolean confirm) {
		this.confirm = confirm;
	}
	public void setCc(Integer cc) {
		this.cc = cc;
	}
	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}

	public void setOc(Integer oc) {
		this.oc = oc;
	}
	public void setOn(String on) {
		this.on = on;
	}

	public void setItemList(List<ConsumingItem> itemList) {
		this.itemList = itemList;
	}

	public void setCode(Integer code) {
		this.code = code;
	}
	public void setCu(Integer cu) {
		this.cu = cu;
	}
	public void setCt(Date ct) {
		this.ct = ct;
	}
	public void setCn(String cn) {
		this.cn = cn;
	}
	
	
	
	
	
}
